package javagame;

import org.newdawn.slick.*;
import org.newdawn.slick.state.*;

public class Controls extends BasicGameState {

	private Image slika;
	private int slikaX;
	private int slikaY;
	
	private int mouseX, mouseY;
	
	public Controls (int state) {}

	public int getID() {
		return 3;
	}

	public void init(GameContainer gc, StateBasedGame sbg) throws SlickException {
		slikaX = 0;
		slikaY = 0;
		slika = new Image("res/controls.png");
	}

	public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException {
		g.drawImage(slika, slikaX, slikaY);
	}
	
	public void fullScreenOnOff (GameContainer gc) throws SlickException {
		if (gc.getInput().isKeyDown(Input.KEY_F)) {
			if (gc.isFullscreen()) {
				gc.setFullscreen(false);
			}
			else {
				gc.setFullscreen(true);
			}
		}
	}

	public void update(GameContainer gc, StateBasedGame sbg, int delta) throws SlickException {
		Input input = gc.getInput();
		mouseX = input.getMouseX();
	  	mouseY = input.getMouseY();
		
	  	fullScreenOnOff(gc);
		
	  	//back
	  	if ((mouseX>312 && mouseX<712) && (mouseY>599 && mouseY<698)) {
			if (input.isMousePressed(0)) {
				sbg.enterState(0);
			}
		}
	}
	
}